<?php
namespace app\admin\validate;
use think\Validate;
class Admin extends Validate
{
    protected $rule=[
      'username'=>'require|max:64|token',
        'password'=>'require',
        'email'=>'email',
        'age'=>'number|between:1,100'
    ];
    protected $message=[
      'username.require'=>'用户名必须填写',
        'password.require'=>'密码必须填写',
        'email'=>'电子邮箱格式不正确',
        'age.between'  => '年龄只能在1-120之间',
        'username.max'=>'名字最多64个字符'
    ];
    protected $scene=[
        'add'=>['username','password'=>'require'],
        'register'=>['username','password','email','age'=>'require|number|between:1,120']
    ];
}